package com.authine.cloudpivot.ext.Enum;

import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * 发票申请状态
 */
@NoArgsConstructor
public enum InvoiceStatus {

    /**
     * 发票状态（0新建,1审核中、2已退回、3待开票、4待收票确认、5已开票、6已取消、7已红冲、8部分红冲）
     */
    New("新建"),
    Approving("审核中"),
    Returned("已退回"),
    DrawerConfirming("待开票"),
    ReceiverConfirming("待收票"),
    Done("已开票"),
    Cancel("已取消");
    public String des;

    public static List<InvoiceStatus> allowToClose() {
        return Arrays.asList(InvoiceStatus.Approving, InvoiceStatus.DrawerConfirming, InvoiceStatus.ReceiverConfirming, InvoiceStatus.Done);
    }

    public static List<InvoiceStatus> settleToClose() {
        return Arrays.asList(InvoiceStatus.New, InvoiceStatus.Returned, InvoiceStatus.Approving, InvoiceStatus.DrawerConfirming);
    }

    /**
     * 已完开票成状态
     * @return
     */
    public static List<InvoiceStatus> invoiced() {
        return Collections.singletonList(InvoiceStatus.Done);
    }

    public static List<String> applied() {
        return Arrays.asList(InvoiceStatus.New.name(),
                InvoiceStatus.Approving.name(),
                InvoiceStatus.Returned.name(),
                InvoiceStatus.DrawerConfirming.name(),
                InvoiceStatus.ReceiverConfirming.name(),
                InvoiceStatus.Done.name());
    }

    InvoiceStatus(String des) {
        this.des = des;
    }
}
